﻿using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

public class FileUnit
{
    /// <summary>
    /// 获取目录中的全部文件路径
    /// </summary>
    /// <param name="dir"></param>
    /// <returns></returns>
    public static string[] GetDirFiles(string dir)
    {
        List<string> files =new List<string>();
        GetDirPath(new DirectoryInfo(dir),files); 
        return files.ToArray();
    }
    static void GetDirPath(DirectoryInfo directory, List<string> files)
    {
        FileInfo[] fileInfos = directory.GetFiles();
        foreach (FileInfo fileInfo in fileInfos)
        {
            if (fileInfo.Extension.Equals(".meta")) continue;
            files.Add(fileInfo.FullName.Replace("\\","/"));
        }
        DirectoryInfo[] directories = directory.GetDirectories();
        foreach (DirectoryInfo director in directories) GetDirPath(director,files);
    }
}
